home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
gnu
/
bash_114.zip
/
bash-1.14.2
/
support
/
mklinks
< prev
next >
Wrap
Text File
|
1992-11-02
|
810b
|
42 lines
# Yet another script which requires an already built Bash.
#
# This makes links in the current directory to the directory specified as
# the first argument.
#
topdir=$1
if [ ! "$topdir" ]; then
echo "No directory specified. Read the script $0."
exit 1
fi
function clone_files ()
{
local dir=$1;
local files;
files=$(cd $dir; echo *);
if [ ! "$files" ]; then
return 0;
fi
for filename in $files; do
if [ -d $dir/$filename ]; then
# If the file to clone is this directory, then skip it.
if [ $(cd $dir/$filename; pwd) = $(pwd) ]; then
continue;
fi
mkdir $filename;
(cd $filename; clone_files ../$dir/$filename)
else
ln -s $dir/$filename .;
fi
done
rm -f \#* *~ .*~ *.bak .*.bak *.tmp .*.tmp *.o core a.out;
}
clone_files $topdir